<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="hmg.vo.BoardVO"%>
<%@ page import="java.util.List"%>
<%--
    JSP Name : jspName.jsp
    Description : 설명을 기술합니다.
    author Kim hyung soo
    since 2012. 10. 10.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 10. 10.     Kim hyung soo     최초 생성
--%>
<%
    List<BoardVO> newsList = (List<BoardVO>) request.getAttribute("NewsList");
    List<BoardVO> motorsList = (List<BoardVO>) request.getAttribute("MotorsList");
    List<BoardVO> eventList = (List<BoardVO>) request.getAttribute("EventList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>그룹소식 서브메인 | 현대자동차그룹</title>
<meta name="description" content="현대자동차그룹 소식, 뉴스레터, 이벤트, 공지사항, 모터스라인, SNS/APP, RSS 안내" />
<meta name="keywords" content="현대자동차그룹 뉴스, 현대차그룹 뉴스, 뉴스" />
<%@ include file="/WEB-INF/jsp/web/kor/include/header.jspf" %>
<script type="text/javascript" src="/hmg/js/web/kor/com/jquery.easing.1.3.js"></script>
<script type="text/javascript">
//<![CDATA[
window.onload = init;

var IntervalBannerM = null;
var IntervalBannerE = null;

function init() {
  IntervalBannerM = window.setInterval("changeBanner('M', 2);", 3000);
  IntervalBannerE = window.setInterval("changeBanner('E', 1);", 3000);
}

// 이벤트 사진 변경
function changeMain() {
  for (var i = 0; i < $(".mainVisualImage").length; i++) {
    if ($(".mainVisualImage:eq(" + i + ")").is(":visible") == true) {
      var j = i + 1;
      if (j > 3) { j = 0; }
      $(".mainVisualImage:eq(" + i + ")").fadeOut(800);
      $(".mainVisualImage:eq(" + j + ")").fadeIn(800);
      return;
    }
  }
}

// 베너 자동 체인지
function changeBanner(type, maxnum) { // (type:베너1,2 / maxnum:베너최대갯수)
    var num_on = 0;
    var btn = "";
    var div = "";
    if (type == "M") {
        btn = "goMicroBtn";
        div = "MicroImage";
    }else if (type == "E") {
        btn = "mainEventBtn";
        div = "EventImage";
    }
    for (var i = 0; i < $("#" + btn + " img").length; i++) {
        if ($("#" + btn + " img:eq(" + i + ")").attr("src").indexOf("_on") > -1) {
            num_on = i;
        }
    }
    num_on = num_on + 1;
    if (num_on > maxnum) { num_on = 0; }
    $("#" + btn + " img").attr("src", "/hmg/images/web/kor/grn/submain/icon_off.gif");
    $("." + div).fadeOut(200);
    $("#" + btn + " img:eq(" + num_on + ")").attr("src", "/hmg/images/web/kor/grn/submain/icon_on.gif");
    $("." + div + ":eq(" + num_on + ")").fadeIn(200);
}

// 베너 버튼 클릭시
function BannerBtn(type, num, maxnum) { // (type:베너1,2 / num:현재버튼 / maxnum:버튼최대갯수)
    clearInterval(IntervalBannerM);
    clearInterval(IntervalBannerE);

    var btn = "";
    var div = "";
    if (type == "M") {
        btn = "goMicroBtn";
        div = "MicroImage";
    } else if (type == "E") {
        btn = "mainEventBtn";
        div = "EventImage";
    }
    if (!$("." + div).is(":animated")) {
        $("." + div).fadeOut(200);
        for (var i = 0; i < maxnum; i++) {
            if (i == (num-1)) {
                $("#" + btn + " img:eq(" + i + ")").attr("src", "/hmg/images/web/kor/grn/submain/icon_on.gif");
                $("." + div + ":eq(" + i + ")").fadeIn(200);
            } else {
                $("#" + btn + " img:eq(" + i + ")").attr("src", "/hmg/images/web/kor/grn/submain/icon_off.gif");
            }
        }
        IntervalBannerM = window.setInterval("changeBanner('M', 2);", 3000);
        IntervalBannerE = window.setInterval("changeBanner('E', 1);", 3000);
    }
}
function BannerStop(){
	clearInterval(IntervalBannerM);
	clearInterval(IntervalBannerE);
}

function BannerPlay(){
	init();
}
//]]>
</script>
</head>
<body>
    <!--wrap-->
    <div id="wrap">
        <!-- skip navigation -->
        <div id="skipnavition">
            <a href="#gnb">메뉴바로가기</a><a href="#content">본문바로가기</a>
        </div>
        <!--// skip navigation -->

        <hr />

        <!-- header-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/left.jspf" %>
        <!--//header-->

        <hr />

        <!--container-->
        <div id="container">
            <div class="scroll-pane">
                <!-- 공통 -->
                <div class="subTitle">
                    <div class="pageTitle">
                        <h2><img src="/hmg/images/web/kor/title/group_News_subMain.gif" alt="그룹소식" /></h2>
                        <p class="subCopy"><img src="/hmg/images/web/kor/title/group_News_subMain_desc.gif" alt="현대자동차그룹의 최근 소식과 각 부문의 다양한 활동들을 알려 드립니다." /></p>
                    </div>

                    <div class="pageLocation">
                        <ul>
                            <li><a href="/hmg/web/kor/Main.do"><img src="/hmg/images/web/kor/common/location_home.gif" alt="홈"/></a></li>
                            <li class="nowPage"><a href="/hmg/web/kor/grn/GroupNewsSubMain.do">그룹소식</a></li>
                        </ul>
                    </div>
                </div>
                <!--//공통-->

                <!--contents-->
                <div id="content">
                    <!-- 내용 -->
                    <div class="groupNews_subMain">

                        <p class="mainVisual"><img src="/hmg/images/web/kor/grn/submain/subMain_img01.jpg" alt="현대자동차 그룹의 최근소식과 각 부문의 다양한 활동들을 알려 드립니다." /></p>

                        <div class="subMain_contents">
                            <div class="newsWrap">
                                <h3><img src="/hmg/images/web/kor/grn/submain/subMain_title01.gif" alt="뉴스" /></h3>
                                <dl>
                                    <dt><%= newsList.get(0).getCompName() %><%= newsList.get(0).getRegDate() %></dt>
                                    <dd class="text"><a href="/hmg/web/kor/grn/nws/NewsView.do?listID=<%= newsList.get(0).getListID() %>&listType=0&compType=0&listFlag=1&page=1"><%= newsList.get(0).getTitle() %></a></dd>
                                    <dd class="image"><a href="/hmg/web/kor/grn/nws/NewsView.do?listID=<%= newsList.get(0).getListID() %>&listType=0&compType=0&listFlag=1&page=1"><img src="<%= newsList.get(0).getThumbnailImage() %>" style="width:226px; height:168px;" alt="" /></a></dd>
                                </dl>
                                <ul>
                                    <li><a href="/hmg/web/kor/grn/nws/NewsView.do?listID=<%= newsList.get(1).getListID() %>&listType=0&compType=0&listFlag=1&page=1"><%= newsList.get(1).getCompName() %><%= newsList.get(1).getTitle() %></a></li>
                                    <li><a href="/hmg/web/kor/grn/nws/NewsView.do?listID=<%= newsList.get(2).getListID() %>&listType=0&compType=0&listFlag=1&page=1"><%= newsList.get(2).getCompName() %><%= newsList.get(2).getTitle() %></a></li>
                                    <li><a href="/hmg/web/kor/grn/nws/NewsView.do?listID=<%= newsList.get(3).getListID() %>&listType=0&compType=0&listFlag=1&page=1"><%= newsList.get(3).getCompName() %><%= newsList.get(3).getTitle() %></a></li>
                                    <li><a href="/hmg/web/kor/grn/nws/NewsView.do?listID=<%= newsList.get(4).getListID() %>&listType=0&compType=0&listFlag=1&page=1"><%= newsList.get(4).getCompName() %><%= newsList.get(4).getTitle() %></a></li>
                                </ul>
                                <p class="moreView"><a href="/hmg/web/kor/grn/nws/NewsList.do"><img src="/hmg/images/web/kor/common/btn_more_submain.gif" alt="뉴스 더보기" /></a></p>
                            </div>

                            <div class="motors_line">
                                <h3><img src="/hmg/images/web/kor/grn/submain/subMain_title02.gif" alt="모터스라인" /></h3>
<%
    for (int idx = 0; idx < motorsList.size(); idx++) {
        BoardVO motors = motorsList.get(idx);

        if (idx + 1 < motorsList.size())
            out.println("                                <dl>");
        else
            out.println("                                <dl class=\"last\">");
%>
                                    <dt><a href="/hmg/web/kor/grn/mtl/MotorsLineView.do?listID=<%= motors.getListID() %>&listType=0&page=1"><%= motors.getListName() %></a></dt>
                                    <dd class="text"><a href="/hmg/web/kor/grn/mtl/MotorsLineView.do?listID=<%= motors.getListID() %>&listType=0&page=1"><%= motors.getTitle() %></a></dd>
                                    <dd class="image"><a href="/hmg/web/kor/grn/mtl/MotorsLineView.do?listID=<%= motors.getListID() %>&listType=0&page=1"><img src="<%= motors.getThumbnailImage() %>" style="width:173px; height:108px;" alt="" /></a></dd>
                                </dl>
<%  } %>
                                <p class="moreView"><a href="/hmg/web/kor/grn/mtl/MotorsLineSubMain.do"><img src="/hmg/images/web/kor/common/btn_more_submain.gif" alt="모터스라인 더보기" /></a></p>
                            </div>

                            <div class="eventWrap">
                                <div class="event">
                                    <h3><img src="/hmg/images/web/kor/grn/submain/subMain_title03.gif" alt="이벤트" /></h3>

                                    <div id="goMicroBtn" class="selMicro">
                                        <a href="#" onclick="javascript:BannerBtn('M', 1, 3);"><img src="/hmg/images/web/kor/grn/submain/icon_on.gif" alt="" /></a>
                                        <a href="#" onclick="javascript:BannerBtn('M', 2, 3);"><img src="/hmg/images/web/kor/grn/submain/icon_off.gif" alt="" /></a>
                                        <a href="#" onclick="javascript:BannerBtn('M', 3, 3);"><img src="/hmg/images/web/kor/grn/submain/icon_off.gif" alt="" /></a>
                                    </div>

                                    <div class="ctrlPlay">
										<a href="#stop" onclick="BannerStop();return false;"><img src="/hmg/images/web/kor/common/btn-stop.png" alt="stop" /></a>
										<a href="#play" onclick="BannerPlay();return false;"><img src="/hmg/images/web/kor/common/btn-play.png" alt="play" /></a>
									</div>

                                    <div id="goMicro">
<%
    for (int idx = 0; idx < eventList.size(); idx++) {
        BoardVO event = eventList.get(idx);

        if (idx == 0)
            out.println("                                        <div class=\"MicroImage\" style=\"display:;\">");
        else
            out.println("                                        <div class=\"MicroImage\" style=\"display:none;\">");
%>
                                            <a href="<%= event.getLink1() %>" target="_BLANK"><img src="<%= event.getThumbnailImage() %>" style="width:260px; height:80px;" alt="<%= event.getTitle() %>" /></a>
                                        </div>
<%  } %>
                                    </div>
                                    <p class="moreView"><a href="/hmg/web/kor/grn/evt/EventList.do"><img src="/hmg/images/web/kor/common/btn_more_submain.gif" alt="이벤트 더보기" /></a></p>
                                </div>
                                <div class="rightContents">
                                    <div class="box01">
                                        <h3><img src="/hmg/images/web/kor/grn/submain/subMain_title04.gif" alt="APP" /></h3>
                                        <p class="image"><a href="/hmg/web/kor/grn/sns/AppView.do"><img src="/hmg/images/web/kor/grn/submain/subMain_img07.jpg" alt=""/></a></p>
                                        <p class="moreView"><a href="/hmg/web/kor/grn/sns/AppView.do"><img src="/hmg/images/web/kor/common/btn_more_submain02.gif" alt="APP 보기" /></a></p>
                                    </div>
                                    <div class="box02">
                                        <h3><img src="/hmg/images/web/kor/grn/submain/subMain_title05.gif" alt="SNS" /></h3>
                                        <p class="image"><a href="/hmg/web/kor/grn/sns/SnsView.do"><img src="/hmg/images/web/kor/grn/submain/subMain_img08.jpg" alt=""/></a></p>
                                        <p class="moreView"><a href="/hmg/web/kor/grn/sns/SnsView.do"><img src="/hmg/images/web/kor/common/btn_more_submain02.gif" alt="SNS 보기" /></a></p>
                                    </div>
                                    <div class="box03">
                                        <h3><img src="/hmg/images/web/kor/grn/submain/subMain_title06.gif" alt="뉴스레터" /></h3>
                                        <p class="image"><a href="/hmg/web/kor/grn/nlt/NewsLetterView.do"><img src="/hmg/images/web/kor/grn/submain/subMain_img09.jpg" alt=""/></a></p>
                                        <p class="moreView"><a href="/hmg/web/kor/grn/nlt/NewsLetterView.do"><img src="/hmg/images/web/kor/common/btn_more_submain02.gif" alt="뉴스레터 보기" /></a></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--// 내용 -->
                </div>
                <!--//contents-->
            </div>
        </div>
        <!--//container-->

        <hr />

        <!--footer-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/footer.jspf" %>
        <!--//footer-->
        <hr />
        <!--notice-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/notice.jspf" %>
        <!--//notice-->
    </div>
    <!--//wrap-->
</body>
</html>